import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import { Message } from 'element-ui'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'; // 默认主题

Vue.use(ElementUI, {
  size: 'small'
});
import 'babel-polyfill';
import 'lib-flexible'
import * as echarts from 'echarts';
import '../src/assets/font_4461777_gqj23n5v0c/iconfont.css';
Vue.prototype.$echarts = echarts;

import axios from 'axios';
Vue.prototype.$axios = axios
import { saveAs } from 'file-saver'
Vue.prototype.$saveAs = saveAs
Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
  let token = sessionStorage.getItem('TOKEN');
 if(!token && to.path != '/' && to.path != '/main'){
  Message.error('登录超时,请重新登录');
   next('/');
 }else{
   next();
 }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
